package com.bauer.framework.autumn;

import com.bauer.framework.autumn.context.AppContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

/**
 * @Author ：rui.wei
 * @Date ：Created in 14:42 2018/7/20
 * @Description： web系统初始化加载类
 */
public class WebStartPoint implements ServletContextListener {


    public final static String APP_CONTEXT_ROOT = "APP_CONTEXT_ROOT";

    private AppContext context;

    @Override
    public void contextInitialized(ServletContextEvent sce) {
        if (context == null) {
            context = new AppContext(sce.getServletContext());
        }
        context.refresh();

        sce.getServletContext().setAttribute(APP_CONTEXT_ROOT, context);
    }
}
